package org.zjt.java.demo.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class ShowController {

	@RequestMapping(value = "/")
    public ModelAndView welcome() {
        ModelAndView result = new ModelAndView("welcome");   //ModelAndView的构造函数放入jsp的名、路径（跳转jsp）
        result.addObject("welcome", "holle zhang!!!");
        return result;
    }
	
	@RequestMapping(value = "/login", method = RequestMethod.GET)
	public ModelAndView login(HttpServletRequest request, HttpServletResponse response){
		ModelAndView result = new ModelAndView("login");   //ModelAndView的构造函数放入jsp的名、路径（跳转jsp）
        result.addObject("welcome", "holle zhang!!!");
		return result;
	}
	
	@RequestMapping(value = "/view")
    @PreAuthorize("hasPermission('hello', 'add')")
    public ModelAndView add() {
        ModelAndView result = new ModelAndView("view");   //ModelAndView的构造函数放入jsp的名、路径（跳转jsp）
        result.addObject("msg", "holle zhang!!!");
        Object obj=null;
        obj.toString();
        return result;
    }
	
	
}
